<!DOCTYPE html>
<html lang="zh-cmn-Hans">
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
    <meta name="description" content="" />
    <meta name="author" content="" />
    <title>文件下载</title>
    {% if not current_app.debug %}
        <!-- Custom fonts for this template -->
        <link href="{{ url_for('static', filename='vendor/fontawesome-free/css/all.min.css') }}" rel="stylesheet" type="text/css" />
        <link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet" />
        <!-- Custom styles for this template -->
        <link href="https://cdn.bootcdn.net/ajax/libs/startbootstrap-sb-admin-2/4.0.7/css/sb-admin-2.min.css" rel="stylesheet">
        <!-- 按钮 https://github.com/alexwolfe/Buttons -->
        <link href="https://cdn.bootcdn.net/ajax/libs/Buttons/2.0.0/css/buttons.min.css" rel="stylesheet">
    {% else %}
        <!-- Custom fonts for this template -->
        <link href="{{ url_for('static', filename='vendor/fontawesome-free/css/all.min.css') }}" rel="stylesheet" type="text/css" />
        <link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet" />
        <!-- Custom styles for this template -->
        <link href="{{ url_for('static', filename='css/sb-admin-2.min.css') }}" rel="stylesheet" />
        <!-- 按钮 https://github.com/alexwolfe/Buttons -->
        <link href="{{ url_for('static', filename='css/buttons.min.css') }}" rel="stylesheet" />
    {% endif %}
    <style>
      .button {
        width: 100%;
        border-radius: 10rem;
      }
    </style>
  </head>
  <body class="bg-gradient-primary">
    <div class="container">
      {% for message in get_flashed_messages(with_categories=True) %}
      <div class="alert alert-{{ message[0] }}" role="alert" style="position: fixed; left: 24px; right: 24px; text-align: center">
        <button type="button" class="close" data-dismiss="alert">&times;</button>
        {{ message[1] }}
      </div>
      {% endfor %}
      <!-- Outer Row -->
      <div class="row justify-content-center">
        <div class="col-xl-6 col-lg-6 col-md-9">
          <div class="card o-hidden border-0 shadow-lg my-5">
            <div class="card-body p-0">
              <!-- Nested Row within Card Body -->
              <div class="p-5">
                <div class="text-center">
                  <h1 class="h4 text-gray-900 mb-2">文件下载</h1>
                  <img id="fileimg" src="/static/img/file.png" />
                  <p class="mb-4">{{ result.filename }}（{{ result.filesize }}）</p>
                </div>
                <form class="user" action="{{ url_for('share.down') }}" method="get" id="downfile">
                  <input type="text" name="code" value="{{ result.code }}" style="display: none" />
                  {% if result.getcode %}
                  <div class="form-group">
                    <input type="text" class="form-control form-control-user" aria-describedby="emailHelp" placeholder="请输入提取码" name="getcode" value="" />
                  </div>
                  {% endif %}
                  <a class="button button-glow button-rounded button-raised button-primary" id="{{ result.code }}" href="javascript:void(0);" onclick="downfile(this.id)"> 下载 </a>
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <canvas class="fireworks" style="position: fixed;left: 0;top: 0;z-index: 1; pointer-events: none;" ></canvas>
    {% if not current_app.debug %}
      <!-- Bootstrap core JavaScript-->
      <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
      <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.5.3/js/bootstrap.bundle.min.js"></script>
      <!-- Core plugin JavaScript-->
      <script src="https://cdn.bootcdn.net/ajax/libs/jquery-easing/1.4.1/jquery.easing.min.js"></script>
      <!-- Custom scripts for all pages-->
      <script src="https://cdn.bootcdn.net/ajax/libs/startbootstrap-sb-admin-2/4.0.7/js/sb-admin-2.min.js"></script>
      <!-- 下载 https://github.com/rndme/download -->
      <!-- <script src="{{ url_for('static', filename='js/download.min.js') }}"></script> -->
      <!-- 烟花 -->
      <script src="https://cdn.jsdelivr.net/npm/animejs@latest/anime.min.js"></script>
      <script src="{{ url_for('static', filename='js/fireworks.js') }}"></script>
      <!-- 按钮 https://github.com/alexwolfe/Buttons -->
      <script src="https://cdn.bootcdn.net/ajax/libs/Buttons/2.0.0/js/buttons.min.js"></script>
      <!-- 粒子运动背景 -->
      <script src="{{ url_for('static', filename='js/canvas-nest.js') }}"></script>
    {% else %}
      <!-- Bootstrap core JavaScript-->
      <script src="{{ url_for('static', filename='vendor/jquery/jquery.min.js') }}"></script>
      <script src="{{ url_for('static', filename='vendor/bootstrap/js/bootstrap.bundle.min.js') }}"></script>
      <!-- Core plugin JavaScript-->
      <script src="{{ url_for('static', filename='vendor/jquery-easing/jquery.easing.min.js') }}"></script>
      <!-- Custom scripts for all pages-->
      <script src="{{ url_for('static', filename='js/sb-admin-2.min.js') }}"></script>
      <!-- 下载 https://github.com/rndme/download -->
      <!-- <script src="{{ url_for('static', filename='js/download.min.js') }}"></script> -->
      <!-- 烟花 -->
      <script src="{{ url_for('static', filename='js/anime.min.js') }}"></script>
      <!-- <script src="https://cdn.jsdelivr.net/npm/animejs@latest/anime.min.js"></script> -->
      <script src="{{ url_for('static', filename='js/fireworks.js') }}"></script>
      <!-- 按钮 https://github.com/alexwolfe/Buttons -->
      <script src="{{ url_for('static', filename='js/buttons.js') }}"></script>
      <!-- 粒子运动背景 -->
      <script src="{{ url_for('static', filename='js/canvas-nest.js') }}"></script>
    {% endif %}
    
    <script src="{{ url_for('static', filename='js/my.js') }}"></script>
    <script>
      //下载
      function downfile(id) {
        //download("{{ url_for('share.down') }}");
        $('#downfile').submit()
      }

      //文件图片
      $(function () {
        var filetype = getFileType('{{ result.filename }}')
        $('#fileimg').attr('src', '/static/img/' + filetype + '.png')
      })

      //消息关闭
      $(function(){$('.alert').delay(6000).fadeOut(1000)});
    </script>
  </body>
</html>
